/**
 * Created by wang on 2016-1-16.
 * 友盟提供的访问统计
 */
define(['angular'], function (angular) {
    "use strict";

    var directive = function (WebService) {
        return {
            restrict: "A",
            link: function (scope, element, attrs) {
                element.bind("click", function () {
                    if (attrs.key && typeof Messenger != 'undefined') {
                        Messenger.sendMsg("ym_event", {eventID: attrs.key}, null, null);
                    }
                    WebService.wtAddAccessRecord(attrs.key, '#/tab/index', attrs.toUrl, null);
                });
            }
        }
    };

    directive.$inject = ['WebService'];
    return directive;
});